<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>六度导航管理系统</title>
		<meta name="renderer" content="bew">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
		<link rel="stylesheet" type="text/css" href="/static/bews/css/login.css">
		<script type="text/javascript" src="/static/layui/layui.js"></script>
<!-- 		<style>
			.layui-layer-msg .layui-layer-content {
				padding: 20px 25px 20px 55px !important;
				font-size: 16px !important;
			}
			.layui-layer-msg .layui-layer-ico {
				transform: scale(1.5);
				left: 15px !important;
			}
		</style> -->
	</head>
	<body>
		<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
			<div class="layadmin-user-login-main">
				<div class="layadmin-user-login-box layadmin-user-login-header">
					<h2><strong>六度导航管理系统</strong></h2>
				</div>
				<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
					<form class="layui-form login-form">
						<div class="layui-form-item">
							<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="username"></label>
							<input type="text" id="username" name="username" placeholder="账号" class="layui-input" value="">
						</div>
						<div class="layui-form-item">
							<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
							<input type="password" name="password" class="layui-input" placeholder="密码" class="layui-input" value="">
						</div>
						<div class="layui-form-item">
							<div class="layui-row">
								<div class="layui-col-xs7">
									<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="code"></label>
									<input type="text" name="code" placeholder="图形验证码" class="layui-input" onkeydown="if(event.keyCode==13){login()}">
								</div>
								<div class="layui-col-xs5">
									<div style="margin-left:10px;">
                                    <img src="{:captcha_src()}" alt="" class="layadmin-user-login-codeimg" onclick="yzm()" id="codeimg">
									</div>
								</div>
							</div>
						</div>
<!--						<div class="layui-form-item" style="margin-bottom: 20px;">-->
<!--							<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">-->
<!--						</div>-->
					</form>
					<div class="layui-form-item">
						<button class="layui-btn layui-btn-fluid" onclick="login()">登 录</button>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript">
	function login(){
		$.post(
			"/login/login",
			$('form').serialize(),//序列化表单
			function(res){
				console.log(res);
				if (res.code==0) {
					layer.msg(res.msg,{"icon":1});
					setTimeout(() => {
						window.location.href="/admin";
					}, 1000);
				} else {
					layer.msg(res.msg,{"icon":2});
					yzm();
				}
			},
			"json"
		);
	}
	function yzm(){
		//$("#codeimg").attr('src','{:captcha_src()}?rand='+Math.random());
		$("#codeimg").attr('src','{:captcha_src()}');
	}
	layui.use(['layer','form'],function(){
		form = layui.form;
		layer = layui.layer;
		$ = layui.jquery;
		// 用户名控件获取焦点
		$('#username').focus();
	});
</script>